package com.wbs.shop.nuby.utils;

import android.text.TextUtils;
import android.util.Log;

import androidx.annotation.NonNull;

/**
 * Created by vicky on 2016/11/3.
 */
public class Logger {

    private static Logger mInstance;
    private static boolean mIsDebug = true;
    private static String TAG = "Logger";

    public static void setDebug(@NonNull boolean debug) {
        mIsDebug = debug;
    }

    public static boolean isDebug() {
        return mIsDebug;
    }

    public static void setTag(String tag) {
        TAG = tag;
    }

    public static void e(String msg) {
        e(TAG, msg, null);
    }

    public static void e(Throwable tr) {
        e(TAG, "", tr);
    }

    public static void e(String tag, String msg) {
        e(tag, msg, null);
    }

    public static void e(String tag, String msg, Throwable tr) {
        if (mIsDebug) {
            if (TextUtils.isEmpty(msg)) {
                Log.e(tag, "输出为空", tr);
            } else {
                Log.e(tag, msg, tr);
            }
        }
    }

}
